package it.csi.finregio.finreges.junit.client.validator;

import java.util.Iterator;

import org.apache.struts.action.ActionMessage;
import org.apache.struts.action.ActionMessages;

import it.csi.finregio.finreges.client.validators.InserisciRiferimentoValidator;
import it.csi.finregio.finreges.presentation.form.SchedaForm;
import junit.framework.TestCase;

public class InserisciRiferimentoValidatorTest extends TestCase {

	public void testValidate() {
		SchedaForm sf = new SchedaForm();
		sf.setDataRiferimento("12/01/1972");
		InserisciRiferimentoValidator v = new InserisciRiferimentoValidator();
		ActionMessages am = v.validate(null, null, sf);
		Iterator it = am.get("dataRiferimento");
		while (it.hasNext()) {
			ActionMessage elem = (ActionMessage) it.next();
			Object[] objs = elem.getValues();
			if(objs!=null){
			for (int i = 0; i < objs.length; i++) {
				Object object = objs[i];
				System.out.println(object);
			}
			}
		}
		System.out.println(am.get("dataRiferimento"));
	}

}
